Crate eventsource_client
source · [−]Expand description
Client for the Server-Sent Events protocol (aka EventSource).
use eventsource_client::Client;
let mut client = Client::for_url("https://example.com/stream")?
.header("Authorization", "Basic username:password")?
.build();
let mut stream = Box::pin(client.stream())
.map_ok(|event| println!("got an event: {}", event.event_type))
.map_err(|e| println!("error streaming events: {:?}", e));
Structs
Client that connects to a server using the Server-Sent Events protocol and consumes the event stream indefinitely.
A connector for the http
scheme.
Configuration for a Client
’s reconnect behaviour.
Builder for ReconnectOptions
.
Enums
Error type returned from this library’s functions.